package my.study.java.lang.Throwable;


public class ThrowableExample01 {

	/**
	 * 输出当前执行的栈信息
	 * @param args
	 */
	public static void main(String[] args) {
		Throwable throwable = new Throwable("mymessage");
		print(throwable);
	}
	
	public static void print(Throwable throwable) {
		System.out.println("getLocalizedMessage: " + throwable.getLocalizedMessage());
		System.out.println("getMessage: " + throwable.getMessage());
		StackTraceElement[] stackTreces = throwable.getStackTrace();
		System.out.println("getStackTrace[");
		if (stackTreces != null) {
			for (StackTraceElement trace : stackTreces) {
				System.out.println(trace);
			}
		}
		System.out.println("]getStackTrace");
	}

}
